package com.zb.springcloud.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.zb.springcloud.service.SentinelService;
import org.springframework.stereotype.Service;

@Service
public class SentinelServiceImpl implements SentinelService {


    @Override
    @SentinelResource(value = "serviceTest", blockHandler = "fallback")
    public String test() {
       throw new NullPointerException("错了");
    }

    public String fallback(BlockException e){
        return "这是服务层失败的兜底方法" + e.getMessage();
    }
}
